

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="style.css"/>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Waiting...</title>
        <script>
            function checkIfReady()
            {
                var xmlhttp=false;
                
                // Create XmlHttpRequest Object
                try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (E) {
                xmlhttp = false;
                }
                }
                if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                        try {
                                xmlhttp = new XMLHttpRequest();
                        } catch (e) {
                                xmlhttp=false;
                        }
                }
                if (!xmlhttp && window.createRequest) {
                        try {
                                xmlhttp = window.createRequest();
                        } catch (e) {
                                xmlhttp=false;
                        }
                }
                
                if (xmlhttp)
                {
                    xmlhttp.open("GET", "Waiting",true);
                    xmlhttp.onreadystatechange=function() {
                        //alert(xmlhttp.responseText);
                        if (xmlhttp.responseText == "1") {
                            window.location = "game";
                        }
                    }
                    xmlhttp.send(null);
                    
                    setTimeout("checkIfReady()",1000);
                }
            }
        </script>
    </head>
    <body onload="checkIfReady();">
        <h1>Please wait until all players register...</h1>
    </body>
</html>
